package greate.project.event1;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class CouponService1 {

    @Async("asyncExecutorService")
    @EventListener// <1>
    public void addCoupon(UserRegisterEvent1 event) {
        System.out.println("coupon: "+Thread.currentThread().getName());
        log.info("[addCoupon][给用户({}) 发放优惠劵]", event.getUsername());
    }
}